<?php
class stu{

 

  public function showGrade(){

    echo "base class";  

  }

 

}

 

 

class xiaomin extends stu{

 

  public function showGrade(){

    echo "is son show 80";  

  } 

}

 

class xiaoli extends stu{

 

  public function showGrade(){

    echo "is son show 60";  

  } 

}

 

function doit($obj){

 

  if(get_class($obj) != "stu"){

    $obj->showGrade();

  }

 

}

 

doit(new xiaoli());

doit(new xiaomin());